  -* TCB-tracker *-  Module File Format
  Typed in by Greenface of 2-Life-Crew
 
Overall structure:
------------------

Offset	format
 
0	8    B		"AN COOL.", header
8	1    L		Number of patterns
12	1    B		Tempo
13	1    B		Unused
14	128  B		Sequences
142	1    W		Restart value
144	1    W		Amiga-button on(1) or off(0)
146	8*16 B		Sample-names
274	16*2 B		Values for the special-functions
306-			Patterns (512 bytes each)

X	1    L		Length of all samples together
X+4	16*4 2B,W	Control values for the samples
X+68	16*8 2L		Sample start and Length
X+196-			Here starts the sample-data
 
Tempo:
------
1 byte containing a value between 0 and F, where F is the fastest.
It determines how often an event will occur.
       Value	Event every ;X; VBL
	0		 16
	1		 15
	-		  -
	8		  8
	-		  -
	F		  1

Sequenses:
----------
128 bytes, where each byte up to restart_value contains a pointer
to a pattern to play.
 
Restart value:
--------------
See above
 
Amiga button:
-------------
Tells you if this module uses Amiga replay-rates.
Amiga samples are sampled at 8.3 KHz, while TCB-tracker uses ST-replay
samples which are sampled at 10 KHz.
If that is the case, you should use 8.3 kHz as the base-replay freq
instead of 10 kHz.

 Value	     Amiga replay-rates
   0		No
   1		Yes 

Sample names:
-------------
8 byte names of the samples in the module, in sequential order.
 
Special function values:
------------------------
10 times 1 word. Each word contains a value that represents the
pitch bend effect for those 10 different pitch bend effects you
have.

Patterns:
---------
Each pattern is 512 bytes long. One pattern consists of 64 events
and each event has 8 bytes of data, 2 for each track.
 
   event format
track 1		1 W
track 2		1 W
track 3		1 W
track 4		1 W
 
   track format
1:st nibble	tone		(1-12)	* Any other number is regarded
2:nd nibble	octav		(1-3)	* as no-change/no-sound
3:rd nibble	sample number	(0-15)
4:th nibble	special effect	(0-15)	*as below
 
Octav can have values 1 to 3 and determines octav of the tone.

Sample number can have values 0 to 15 and determines which sample
is to be played.

Special effect can have values 0 - 15
Value              meaning
 0		no special effect
 1 - A		Pitch bend (look special effect values)
 B		Cut sample
 C		Continue cut sample
 D		End pattern
 E		Reserved
 F		Reserved
 
Tone can have:
Value	      Tone to play
  0		C
  1		C#
  2		D
  3		D#
  4		E
  5		F
  6		F#
  7		G
  8		G#
  9		A
 10		A#
 11		B

If you combine the octav and tone values you get 36 different values
which determines at what frequency the sample is to be played.
See below.

		replay-frequency (Hz)
Tone-Octav	off ,Amiga button, on	     byte value 
   C -1		 5000		 4150		17
   C#-1		 5297		 4397		18
   D -1		 5612		 4658		19
   D#-1		 5946		 4935		20
   E -1		 6300		 5229		21
   F -1		 6674		 5540		22
   F#-1		 7071		 5869		23
   G -1		 7492		 6218		24
   G#-1		 7937		 6588		25
   A -1		 8409		 6979		26
   A#-1		 8909		 7394		27
   B -1		 9439		 7834		28
   C -2		10000		 8300		33
   C#-2		10595		 8794		34
   D -2		11225		 9316		35
   D#-2		11892		 9870		36
   E -2		12599		10457		37
   F -2		13348		11079		38
   F#-2		14142		11738		39
   G -2		14983		12436		40
   G#-2		15874		13175		41
   A -2		16818		13959		42
   A#-2		17818		14789		43
   B -2		18877		15668		44
   C -3		20000		16600		49
   C#-3		21189		17587		50
   D -3		22449		18633		51
   D#-3		23784		19741		52
   E -3		25198		20915		53
   F -3		26697		22158		54
   F#-3		28284		23476		55
   G -3		29966		24872		56
   G#-3		31748		26351		57
   A -3		33636		27918		58
   A#-3		35636		29578		59
   B -3		37755		31337		60

	The sample structure
        --------------------

Right after all the patterns comes the sample-package.
 
Sample control values:
----------------------
16 times 4 bytes.
First byte contains the sample volume. (0-128)
Where 128 is the highest)
Second byte unused.
The next word is the loop-value.
 
Sample start and length:
------------------------
16 times 8 bytes.
First longword contains the offset-value from where the patterns end
to where the sample start, next longword is the sample-length.
 
Sample data:
------------
Is in ST-replay format. (0-255)
(The STEs PCM-format is (-128 to +127)
